Skip to content

feat: add extensibility points for HttpContent matchers#466

Merged
vbreuss merged 2 commits into
mainfrom
topic/extensibility-httpcontent
Feb 8, 2026
Merged

feat: add extensibility points for HttpContent matchers#466
vbreuss merged 2 commits into
mainfrom
topic/extensibility-httpcontent

Conversation

@vbreuss

@vbreuss vbreuss commented Feb 8, 2026

Copy link
Copy Markdown
Member

Adds predicate-based extensibility points for matching HttpContent bodies, updates tests/docs accordingly, and adjusts the public API surface to reflect the new matcher options.

Key Changes:

  • Added predicate overloads for matching string and binary HttpContent bodies.
  • Updated/extended HttpClient/HttpRequestMessage matcher tests and renamed string-related test cases for clarity.
  • Updated documentation and API expectation snapshots; removed the old WithBytesContaining surface.

@vbreuss vbreuss self-assigned this Feb 8, 2026
@vbreuss vbreuss added the enhancement New feature or request label Feb 8, 2026
Copilot AI review requested due to automatic review settings February 8, 2026 08:03
@vbreuss vbreuss added the breaking change The changes require a new major version label Feb 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds predicate-based extensibility points for matching HttpContent bodies, updates tests/docs accordingly, and adjusts the public API surface to reflect the new matcher options.

Changes:

  • Added predicate overloads for matching string and binary HttpContent bodies.
  • Updated/extended HttpClient/HttpRequestMessage matcher tests and renamed string-related test cases for clarity.
  • Updated documentation and API expectation snapshots; removed the old WithBytesContaining surface.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpRequestMessageTests.WhoseContentIsTests.cs Adds new request-content predicate tests and renames string matcher tests.
Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithStringTests.cs Adds predicate-based WithString tests and removes an unused regex using.
Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithBytesTests.cs Adds predicate-based WithBytes tests.
Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithBytesContainingTests.cs Removes tests for the removed WithBytesContaining API.
Tests/Mockolate.Api.Tests/Expected/Mockolate_netstandard2.0.txt Updates expected API surface for netstandard2.0.
Tests/Mockolate.Api.Tests/Expected/Mockolate_net8.0.txt Updates expected API surface for net8.0.
Tests/Mockolate.Api.Tests/Expected/Mockolate_net10.0.txt Updates expected API surface for net10.0.
Source/Mockolate/Web/ItExtensions.HttpContent.cs Implements predicate-based matchers for string/bytes and removes WithBytesContaining.
README.md Documents new predicate-based matcher overloads and removes WithBytesContaining.
Docs/pages/special-types/01-httpclient.md Mirrors README docs update for new overloads and removed API.

Comment thread Source/Mockolate/Web/ItExtensions.HttpContent.cs
Comment thread Source/Mockolate/Web/ItExtensions.HttpContent.cs
Comment thread Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithStringTests.cs Outdated
@github-actions

github-actions Bot commented Feb 8, 2026

Copy link
Copy Markdown

Test Results

    21 files  ±0      21 suites  ±0   6m 2s ⏱️ -19s
 2 707 tests ±0   2 706 ✅ ±0  1 💤 ±0  0 ❌ ±0 
18 165 runs  ±0  18 164 ✅ ±0  1 💤 ±0  0 ❌ ±0 

Results for commit 575376a. ± Comparison against base commit bdaa629.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Feb 8, 2026

Copy link
Copy Markdown

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763 2.89GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.102
[Host] : .NET 10.0.2 (10.0.2, 10.0.225.61305), X64 RyuJIT x86-64-v3

Job=InProcess Toolchain=InProcessEmitToolchain IterationCount=15
LaunchCount=1 WarmupCount=10

Method Mean Error StdDev Gen0 Gen1 Allocated
Simple_Mockolate 1.576 μs 0.0314 μs 0.0294 μs 0.2270 - 3.73 KB
Simple_Moq 187.814 μs 1.5868 μs 1.4843 μs 0.4883 - 14.55 KB
Simple_NSubstitute 5.731 μs 0.0472 μs 0.0442 μs 0.5569 0.0076 9.14 KB
Simple_FakeItEasy 6.477 μs 0.1084 μs 0.1014 μs 0.4959 - 8.11 KB

@sonarqubecloud

sonarqubecloud Bot commented Feb 8, 2026

Copy link
Copy Markdown

@vbreuss vbreuss merged commit e4aa7a2 into main Feb 8, 2026
12 checks passed
@vbreuss vbreuss deleted the topic/extensibility-httpcontent branch February 8, 2026 08:28
@github-actions

github-actions Bot commented Feb 8, 2026

Copy link
Copy Markdown

This is addressed in release v1.4.0.

@github-actions github-actions Bot added the state: released The issue is released label Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change The changes require a new major version enhancement New feature or request state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add extension points for HttpContent

2 participants